-- card: 58255 from stack: in -- bmap block id: 0 -- flags: 0000 -- background id: 4755 -- name: -- part contents for background part 4 ----- text ----- (mimicking the right-to-left action of the '=' assignment operator). It is important to distinguish among string constants, character arrays, and character pointers variables, all of which are treated as character pointers. When a character pointer variable is declared, no space is yet allocated for a character array. Therefore it is appropriate to use the '=' assignment operator to assign to the pointer variable a pointer to a string, but it is unwise to use strcpy() to assign to the unallocated portion of memory initially pointed to by the pointer variable. On the other hand when a character array is declared, space is allocated for the array elements. However, an array name is a constant pointer so it may not be assigned to. Also, in ANSI C it is illegal to assign a new value to a string constant (although TC still allows this): char *ptr1, ptr2[80], *ptr3; /* allocate two character pointers and one array */ ptr1 = "Hello, world!"; /* ok. ptr1 now points to the constant string */ *(ptr1+7) = 'x'; /* illegal! Attempts to change 'w' in constant string */ ptr2 = "Hello, world!"; /* illegal! ptr2 is a pointer constant, not variable */ strcpy(ptr3,"Hello, world!"); /* incorrect! Copies string to unallocated memory */ -- part contents for background part 7 ----- text ----- 195